<%#
 Copyright 2013-2019 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-%>
jacoco {
    toolVersion = '0.8.3'
}

jacocoTestReport {
    reports {
        xml.enabled true
    }
}

sonarqube {
    properties {
        property "sonar.host.url", "http://localhost:9001"
        property "sonar.exclusions", "<%= CLIENT_MAIN_SRC_DIR %>content/**/*.*,<%= CLIENT_MAIN_SRC_DIR %>i18n/*.js, <%= CLIENT_DIST_DIR %>**/*.*"

        property "sonar.issue.ignore.multicriteria", "S3437,<% if (authenticationType === 'jwt') { %>S4502,<% } %>S4684,UndocumentedApi,BoldAndItalicTagsCheck"

        // Rule https://sonarcloud.io/coding_rules?open=Web%3ABoldAndItalicTagsCheck&rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is recommended by http://fontawesome.io/examples/
        property "sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey", "><%= CLIENT_MAIN_SRC_DIR %>app/**/*.*"
        property "sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey", "Web:BoldAndItalicTagsCheck"

        // Rule https://sonarcloud.io/coding_rules?open=squid%3AS3437&rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient
        property "sonar.issue.ignore.multicriteria.S3437.resourceKey", "<%= MAIN_DIR %>java/**/*"
        property "sonar.issue.ignore.multicriteria.S3437.ruleKey", "squid:S3437"

        // Rule https://sonarcloud.io/coding_rules?open=squid%3AUndocumentedApi&rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names should be self-explanatory
        property "sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey", "<%= MAIN_DIR %>java/**/*"
        property "sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey", "squid:UndocumentedApi"
        <%_ if (authenticationType === 'jwt') { _%>
        // Rule https://sonarcloud.io/coding_rules?open=squid%3AS4502&rule_key=squid%3AS4502 is ignored, as for JWT tokens we are not subject to CSRF attack
        property "sonar.issue.ignore.multicriteria.S4502.resourceKey", "src/main/java/**/*"
        property "sonar.issue.ignore.multicriteria.S4502.ruleKey", "squid:S4502"
        <%_ } _%>

        // Rule https://sonarcloud.io/coding_rules?open=squid%3AS4684&rule_key=squid%3AS4684
        property "sonar.issue.ignore.multicriteria.S4684.resourceKey", "src/main/java/**/*"
        property "sonar.issue.ignore.multicriteria.S4684.ruleKey", "squid:S4684"

        property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec"
        property "sonar.java.codeCoveragePlugin", "jacoco"
        property "sonar.typescript.lcov.reportPaths", "${project.buildDir}/test-results/lcov.info"
        property "sonar.junit.reportPaths", "${project.buildDir}/test-results"
        property "sonar.sources", "${project.projectDir}/<%= MAIN_DIR %>"
        property "sonar.tests", "${project.projectDir}/<%= TEST_DIR %>"
    }
}
